<template>
	<view>
		v-on事件
	</view>
	<view class="box" @click="isColor" :style="{backgroundColor:color}"></view>
	<switch @change="isChange" />
	<button type="primary" :loading="isLoading">按钮</button>
</template>

<script setup>
	import {ref} from "vue"
	const color = ref('');
	const isLoading = ref(false);
	function isColor () {
		color.value = 'red'
	}
	function isChange (e) {
		//控制是否加载 e为@change返回对象
		isLoading.value = e.detail.value
	}
</script>

<style lang="scss" scoped>
	.box {
		width: 300px;
		height: 300px;
		background-color: orange;
	}       
</style>
